package routers

import (
	"github.com/gin-gonic/gin"

	"demo0606/controllers"
	"demo0606/middleware"
)

func InitRouteLogin(r *gin.Engine) {
	router := r.Group("/apis")
	router.POST("/dologin", controllers.Users{}.Dologin)
	router.POST("/uploadPic", controllers.Users{}.UploadPic)
	router.POST("/uploadEventsPic", controllers.Users{}.UploadEventsPic)
}
func InitRoutes(r *gin.Engine) {
	router := r.Group("/apis", middleware.YanJWT)
	router.GET("/loginOut", controllers.Users{}.LoginOut)
	// 用户
	router.GET("/users", controllers.Users{}.TestTemplate)
	router.GET("/getUserList", controllers.Users{}.GetUserList)
	router.POST("/addUser", controllers.Users{}.AddUser)
	router.PUT("/updateUser", controllers.Users{}.UpdateUser)
	router.POST("/deleteUser", controllers.Users{}.DeleteUser)
	router.PUT("/changeUserRole", controllers.Users{}.ChangeUserRole)
	// 轮播图
	// router.POST("/uploadPic", controllers.Users{}.UploadPic)
	router.POST("/addPicList", controllers.Users{}.AddPicList)
	router.GET("/getPicList", controllers.Users{}.GetPicList)
	router.GET("/getBannerList", controllers.Users{}.GetBannerList)
	router.PUT("/switchShow", controllers.Users{}.SwitchShow)
	router.GET("/deletePic", controllers.Users{}.DeletePic)
	// 角色
	router.POST("/addRole", controllers.Role{}.AddRole)
	router.DELETE("/deleteRole", controllers.Role{}.DeleteRole)
	router.PUT("/updateRole", controllers.Role{}.UpdateRole)
	router.GET("/getRoleList", controllers.Role{}.GetRoleList)
	router.PUT("/changeAuthList", controllers.Role{}.AddAuth)
	// 权限
	router.POST("/addAuth", controllers.Auth{}.AddAuth)
	router.GET("/deleteAuth", controllers.Auth{}.DeleteAuth)
	router.PUT("/updateAuth", controllers.Auth{}.UpdateAuth)
	router.GET("/getAuthList", controllers.Auth{}.GetAuthList)
	router.PUT("/changeRoleList", controllers.Auth{}.ChangeAuthRoles)
	// 时间轴事件管理
	router.POST("/addEvents", controllers.Events{}.AddEvents)
	router.GET("/getEvents", controllers.Events{}.GetEvents)
	router.DELETE("/deleteEvents", controllers.Events{}.DeleteEvents)
	router.PUT("/editEvents", controllers.Events{}.EditEvents)
	router.GET("/getEventsById", controllers.Events{}.GetEventsById)
}

func InitRoutesNoAuth(r *gin.Engine) {
	router := r.Group("/")

	router.GET("/getBannerList", controllers.Users{}.GetBannerList)
	router.GET("/api2/getBannerList", controllers.Users{}.GetBannerList)
	router.GET("/api2/getEvente", controllers.Events{}.GetEvents)
	router.GET("/api2/getEventsById", controllers.Events{}.GetEventsById)
	router.GET("/guanlian", controllers.Auth{}.Guanlian)
	router.GET("/guanlian2", controllers.Auth{}.Guanlian2)

}
